package com.wbc.smartHome.dao;

import com.wbc.smartHome.model.CommodityType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface CommodityTypeDao {

    @Insert("insert into commodity_type(name,img,adminid,content,oper_time)values (#{name},#{img},#{adminId},#{content},now())")
    void setCommodityType(String name, String content, String img, int adminId);

    List<CommodityType> getCommodityTypeList(CommodityType commodityType);

    @Delete("delete from commodity_type where id = #{id}")
    void delete(int id);


    @Update("update commodity_type set name = #{name},img = #{img} , adminid = #{adminId} , content = #{content} ,oper_time = now() where id=#{id}")
    void updateCommodityType(Integer id, String name, String content, String img, int adminId);

    @Select("select id,name,img,content from commodity_type where id = #{commodity_type}")
    CommodityType getCommodityTypeById(int id);
}
